if (Test-Path .\build) {
    Remove-Item .\build\ -Recurse -Force
}
if (Test-Path .\dist) {
    Remove-Item .\dist\ -Recurse -Force
}
if (Test-Path .\*.spec) {
    Remove-Item .\*.spec
}
conda init
conda activate env_snow
conda env export > .\environment.yml
$dateSuffix = Get-Date -Format "yyMMdd"
$snowName = "SNOW" + $dateSuffix
pyinstaller.exe -Fw .\main.py -n $snowName -i .\snow-logo.png --splash .\snow-logo-big.png --upx-dir $env:UPX_DIR --clean
if (Test-Path .\dist\) {
    Copy-Item .\config\ .\dist\ -Recurse -Force
    Copy-Item .\snow-logo.png .\dist\
    Copy-Item ".\default-template.yml" .\dist\
}
$zipPath = "$env:USERPROFILE\Desktop\$snowName.zip"
Compress-Archive -Path .\dist\* -DestinationPath $zipPath -Force

# & "C:\Program Files (x86)\Inno Setup 6\Compil32.exe" .\snow-setup.iss
